home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_2 / guispell-1.0 / rexx / ced / spell.ced < prev    next >
Text File  |  1992-03-25  |  2KB  |  102 lines

  1. /*  
  2.  *  Spell.ced ... ARexx Program to spell check a file while in CED!
  3.  *  Requires ISpell version 2.1ljr with ARexx Server mode.
  4.  *  Started: LJR  ?
  5.  *  Updated for CED v2.0: LJR  Tue Jan 23 04:22:16 1990
  6.  *  Updated for OS 2.04: LJR  Sat Nov 23 17:40:36 1991
  7.  *  Copyright © 1990, 1991  Loren J. Rittle
  8.  *  Use as you will, just document your changes and keep my copyright
  9.  *  notice intact.
  10.  *
  11.  *  Loren J. Rittle
  12.  *  l-rittle@uiuc.edu
  13.  */
  14. options results
  15. status 21
  16. buffername = result
  17. errorname = buffername || '.err'
  18. whereclip = address() || 'where' || buffername
  19.  
  20. where = getclip(whereclip)
  21. if where ~== "" then do
  22.   if open('err', 'ram:@@'errorname,'r') = 0 then do
  23.     okay1 'Can''t open ram:errorfile!'
  24.     exit 0
  25.   end
  26.   seek('err', where, 'Begin')
  27.   word = readln('err')
  28.   if word = "" then do
  29.     close('err')
  30.     okay1 "No more errors were found!"
  31.     address command 'delete ram:@@'buffername 'ram:@@'errorname
  32.     setclip(whereclip)
  33.     exit 0
  34.   end
  35.  
  36.   address 'IRexxSpell' check word
  37.   line = result
  38.   parse var word '&' choices
  39.  
  40.   search for... word 0 0 1 1
  41.   if choices =  "" then
  42.     okay1 "Nothing good found for" word||"."
  43.   else
  44.     okay1 "Try"||choices||"0a"x||"in place of" word||"."
  45.   where = seek('err', 0, 'Current')
  46.   call setclip whereclip, where
  47.   close('err')
  48.  
  49.   exit (0)
  50. end
  51.  
  52. if pos('IRexxSpell',(show(ports))) = 0 then do
  53.   address command 'run <null: >null: ispell -r >null: <null:'
  54.   address command waitforport 'IRexxSpell'
  55. end
  56. beg of file
  57. mark block
  58. 'end of file'
  59. copy block
  60. 'save block to file...' "ram:@@"buffername
  61. mark block
  62. left
  63. copy block
  64. beg of file
  65.  
  66. address 'IRexxSpell' filecheck "ram:@@"buffername
  67. r = result
  68. if pos('Error', r) ~= 0 then do
  69.   okay1 'ISpell' r
  70. end
  71.  
  72. address command copy r "ram:@@"errorname
  73. address command delete r
  74. if open('err', 'ram:@@'errorname,'r') = 0 then do
  75.   okay1 'Can''t open ram:errorfile!'
  76.   exit 0
  77. end
  78.  
  79. word = readln('err')
  80. if word = "" then do
  81.   close('err')
  82.   okay1 "No errors were found!"
  83.   address command 'delete ram:@@'buffername 'ram:@@'errorname
  84.   setclip(whereclip)
  85.   exit 0
  86. end
  87.  
  88. address 'IRexxSpell' check word
  89. line = result
  90. parse var word '&' choices
  91.  
  92. search for... word 0 0 1 1
  93. if choices =  "" then
  94. okay1 "Nothing good found for" word||"."
  95. else
  96. okay1 "Try"||choices||"0a"x||"in place of" word||"."
  97.  
  98. where = seek('err', 0, 'Current')
  99. call setclip whereclip, where
  100. close('where')
  101. close('err')
  102.